Ubuntu fresh setup guide

Update & Upgrade

sudo apt update && sudo apt upgrade -y

Install Packages

sudo apt-get install python3-pip zsh curl wget git dconf-editor
sudo apt-get install p7zip-full smplayer speedtest-cli git-gui pavucontrol paprefs ufw nmap fail2ban gimp most colordiff ncdu qalculate-gtk jq tor thunderbird chrome-gnome-shell gnome-tweaks smartmontools &

# Probably not needed anymore
# fonts-noto

pip install pipx
pipx install yt-dlp tldr llm pipenv

External Repositories

llm and ??

config llm

llm install llm-claude-3
llm keys set claude # Insert Claude API key generated in https://console.anthropic.com/settings/keys

script: https://gist.github.com/madacol/2e8e2f5e22b03bfe4f22fbe30dd9c978

#!/bin/zsh

# This script needs to be sourced in a zsh shell instead of being executed
# To do so, set an alias in your shell:
#    alias '??'='source $HOME/.local/bin/nlsh.zsh'
# Then you can use the `??` command from any zsh shell like this:
#    ?? extract the content of ./file.zip in the current directory

echo "$@" \
| llm -s 'Your task is to output oneliner shell commands.
Always answer with a single line shell command, or a multiline using code blocks' \
| tee /dev/shm/nlsh_stdout

extracted_command=$(sed -n '/^[ \t]*```/,/^[ \t]*```/{//!p}' /dev/shm/nlsh_stdout)

# If the command is empty, get the last line of the output
if [ -z "$extracted_command" ]; then
    extracted_command=$(tail -n 1 /dev/shm/nlsh_stdout)
fi

print -rz $extracted_command

add alias ?? in ~/.zshrc

alias ??='source $HOME/.local/bin/nlsh.zsh'

Web installs

Shells

Zsh - Edit ~/.zshrc

Add ~/.local/bin to PATH

export PATH=$HOME/.local/bin:$PATH

Add shortcut “Alt+:” to iterate through arguments

autoload -Uz copy-earlier-word
zle -N copy-earlier-word
bindkey "^[:" copy-earlier-word

Aliases

alias youtube-dl=yt-dlp
alias youtube-dl720='yt-dlp -f "bestvideo[height<=720]+bestaudio/best[height<=720]"'
function mkcd () { mkdir -p "$@" && cd "$@"; }

Enable most

export PAGER=most

Enable zsh plugins

plugins=(git zsh-syntax-highlighting zsh-autosuggestions)

Note: Probably need to install them first

Gnome extensions

Dconf

Custom shortcuts

StartUp

Nautilus

Add context menu to convert to MP4 using ffmpeg

nano ~/.local/share/nautilus/scripts/Convert\ to\ MP4
chmod +x ~/.local/share/nautilus/scripts/Convert\ to\ MP4
#!/bin/bash
ffmpeg -i ${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}\
        -y -vf "scale='bitand(oh*dar,65534)':'min(720,ih)'"\
        /dev/shm/video.mp4\
        2> /dev/shm/convertToMP4.log

Old stuffs

Built-in dash-to-dock extension

Zsh

Lazy-load nvm

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . $NVM_DIR/nvm.sh --no-use;
[ -s "$NVM_DIR/bash_completion" ] && . $NVM_DIR/bash_completion;
function __nvm_load_node () {
  unalias node npm npx;
  nvm use 2> /dev/null || nvm use default;
  command=$1;
  shift 1;
  $command $@;
}
alias node='__nvm_load_node node $@'
alias npm='__nvm_load_node npm $@'
alias npx='__nvm_load_node npx $@'

Fish

Functions

Antimicro

sudo add-apt-repository ppa:mdeguzis/libregeek

As of today, a bionic package is still not available, but the artful works!. https://github.com/AntiMicro/antimicro/issues

sudo nano /etc/apt/sources.list.d/mdeguzis-ubuntu-libregeek-bionic.list Replace bionic with artful

sudo apt update
sudo apt install antimicro

Put config file https://gist.github.com/madacol/19f8c71ba98f484a4294ccfe90e88e6e in ~/.config/antimicro

SinkSwitcher

https://github.com/madacol/sinkSwitcher